package dao;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;

import bean.Fund;

public class CreateFundDAO extends DAO<Fund>{

	public CreateFundDAO(SessionFactory factory) {
		super(factory);
	}
	
	public void createFund(Fund fund) {
		Transaction tx = null;
		Session session = null;
		try {				
			session = this.getSession();
			tx = session.beginTransaction();
			session.save(fund);
			tx.commit();
		} catch (HibernateException e) {
			if (tx != null)
				tx.rollback();
			e.printStackTrace();
		} finally {
			if(session != null)	session.close();
		}
	}
}
